The invention relates generally to the field of digital computers, and more particularly to an arrangement for facilitating an efficient emulation of an operating system call structure provided by a microprocessor of one architecture, during emulation of programs written for that microprocessor by a microprocessor of another architecture.
Digital computers process a variety of diverse types of programs, with each program including a series of instructions that enable the computer to perform specific operations in connection with specific elements of data. A variety of types of processors are available for use in digital computer systems, with each type of processor being constructed in accordance with an architecture which describes, inter alia, the set of instructions that a processor constructed in accordance with the architecture is expected to execute, the format(s) of the various instructions, the types and formats of data which may be processed, definitions for various registers that may be used during instruction processing, how information in the computer""s memory will be accessed and how a processor constructed in accordance with the architecture is to handle exception conditions which may be detected during instruction processing.
It is often desirable to enable one type of processor, as an xe2x80x9cemulated processor,xe2x80x9d to be emulated by another type of processor, as a xe2x80x9chost processor.xe2x80x9d A host processor generally emulates an emulated processor by processing programs which have been written for the emulated processor, to generate an output that effectively corresponds to the output that would be generated by the emulated processor. Generally, emulation is accomplished by translating a program generated for execution by an emulated processor (an xe2x80x9coriginalxe2x80x9d program) into a program which may be processed by a host processor (a xe2x80x9ctranslatedxe2x80x9d program). This translation process may include, for example, generating from instructions and other elements of the original program, instructions and other elements which are based on the host processor""s architecture thereby to provide the translated program. The translation may be performed by, for example, the host processor itself, by another processor in the same computer system or by another computer system and made available to the host processor which is to process the program, under control of a translation program. In performing the translation, each instruction or sequences or various groups of instructions in the original program (that is, the program based on the emulated processor""s architecture) may be translated into one or a series or group of instructions for processing by the host processor. The translation process is typically performed for all or selected portions of an original program when the processor begins processing the original program, although it will be appreciated that an instruction or group of instructions of the original program may be translated as the processing proceeds. In addition, if the emulated processor""s data formats are not directly useable by the host processor, the data may be processed to convert it from the emulated processor""s formats to formats usable by the host processor.
Typically, programs are constructed to be processed under control of a particular operating system, such as Unix or Microsoft Windows(trademark) or one of many other operating systems that are available. Operating systems are programs that provide a number of low-level services, such as interacting with the computer""s hardware to retrieve data for processing by the program, receiving operator input through an operator input device such as a keyboard or mouse, controlling graphical display of output data on a video display device, and many other services. An operating system performs services for a program in response to xe2x80x9ccallsxe2x80x9d made thereto by the program. Since an operating system is also a program, during emulation of a program by a host processor, it is possible to also emulate the operating system. However, if the operating system normally used with the host processor provides services that are similar to those provided by the operating system for the program being emulated, it may be more efficient to have the host processor""s operating system provide those services. A problem arises, however, if calls to the host processor""s operating system are made in significantly a different manner than in the operating system used with the emulated program.
The invention provides a new and improved arrangement and method for facilitating an efficient emulation of an operating system call structure provided by a microprocessor of one architecture, during emulation of programs written for that microprocessor by a microprocessor of another architecture.
In brief summary, the invention provides operating system call control subsystem for use in a computer that includes a processor for processing a program, the program including instructions of an operating system call instruction type identifying one of a plurality of types of operating system calls, each type of operating system call being associable with an operating system call type identifier value within a predetermined range of values (step 110 in FIG. 6). The operating system call control subsystem comprises a crossover table, an operating system call instruction type address resolution module 27 (FIG. 1), and an operating system call instruction type processing module 28 (FIG. 1). The crossover table has a number of entries corresponding to a predetermined fraction of the predetermined range, each entry in the crossover table having an instruction for enabling the processor to save a value corresponding to an offset of the entry into the crossover table (step 111 in FIG. 6). The operating system call instruction type address resolution module provides the instructions of the operating system call instruction type with respective target addresses that include an operating system call set identifier in a set of operating system call set identifiers, the number of operating system call set identifiers multiplied by the number of crossover table entries corresponding to the predetermined range and an offset value corresponding to an offset to an entry into the crossover table (step 112 in FIG. 6). The operating system call instruction type processing module, in response to the processor processing an instruction of the operating system call instruction type, (a) saves the operating system call set identifier from the target address, (b) selects one of the entries in the crossover table using the offset value of the target address, (c) processes the instruction from the selected entry of the crossover table to save the value corresponding to the offset of the selected entry in the crossover table, and (d) generates the operating system call type identifier value in connection with the saved operating system call set identifier and the saved value corresponding to the offset of the selected entry into the crossover table (step 113 in FIG. 6). Since the operating system call type identifier value is generated in relation to the particular one of the operating system call set identifier as well as the offset of the selected entry into the crossover table, the crossover table can be construct to have a relatively small fraction of the number of entries which might otherwise be required if one entry were provided for each possible value in the predetermined range.